#include <iostream>
using namespace std;
int main()
{
	int num,sum;
	cin >> num;
	for(int i = 0;i<num;i++)
	{
		for(int j = 0;j<num;j++)
		{
			if(i*num+j+1<10)
			{
				cout << "0";
			}
			cout << i*num+j+1;
		}
		cout << endl;
	}
	cout << endl;
	
	for(int i = 0;i<num;i++)
	{
		sum = sum + i+1 ;
	}
	
	int dis = (num-1) * 2; // 6
	int k = 0;
	for(int i = 1;i<=num;i++)
	{
		int temp = dis;
		while(temp!=0)
		{
			cout << " ";
			temp = temp - 1;
		}
		for(int j = 0;j<i;j++)
		{
			k = k + 1;
			if(k < 10){
				cout << "0";	
			}
			cout << k;
		}
		cout << endl;
		dis = dis - 2;
	}
	
	return 0;
}
